<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a = 20
        var obj = {
            a : 10,
            asy : function (){
                var _this = this
                setTimeout(function(){
                    console.log(this.a) // 指向的是 setInterval里的function，找不到调用，所以指向window，a = 20
                    console.log(_this.a) //先用_this把指向obj的this存储下，这样就可以调用_this就指向obj
                },1000)
            }
        }
        obj.asy()
    </script>
</body>
</html>